package com.lecyon.farm.mapper;

import com.lecyon.farm.entity.elasticsearch.WorkOutPoints;
import org.springframework.data.elasticsearch.annotations.Query;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * ElasticsearchRepository --> ElasticsearchCrudRepository --> PagingAndSortingRepository --> CrudRepository
 *
 * @author Yao Zheng
 * @Date 2020/4/29 13:12
 */
@Component
public interface WorkOutPointsRepository extends ElasticsearchRepository<WorkOutPoints, String> {

    /**
     * 根据workSerial查询地块外围点
     *
     * @param workSerial
     * @return
     */
    @Query("{\"bool\" : {\"must\" : {\"term\" : {\"work_serial\" : \"?0\"}}}}")
    List<WorkOutPoints> findByWorkSerial(String workSerial);

//    /**
//     * 根据workSerial查询地块外围点
//     * @param workSerial
//     * @return
//     */
//    List<WorkOutPoints> findByWork_serial(String workSerial);
}
